<?php
if ( phpversion() >= "4.2.0")
{  
    extract($_POST);  
    extract($_GET);  
    extract($_SERVER);  
} 

if(!empty($page)){urldecode($page);}

require_once "../include/config.php";
require_once "../include/functions.php";
require_once "tools.php";

if(is_user_loggedin()=="false")
{
echo "
<script type='text/javascript'>
<!--
window.location = '../index.php?page=signin';
//-->
</script>
";
exit;
}

if(get_user_group() != "1")
{
echo "
<script type='text/javascript'>
<!--
window.location = '../index.php';
//-->
</script>
restricted access.
";
exit;
}

if(!empty($save_general_options) and $save_general_options=="yes")
{
//echo $site_name;
//echo $site_slogan;
//echo $forum_url;
//echo $community_url;
//echo $facebook;
//echo $twitter;
//echo $google_analytics;
//echo $meta_code;
//echo $ffmpeg_path;

write_option("site_name", $site_name);
write_option("site_slogan", $site_slogan);
write_option("forum_url", $forum_url);
write_option("community_url", $community_url);
write_option("facebook", $facebook);
write_option("twitter", $twitter);
write_option("google_analytics", $google_analytics);
write_option("meta_tags", $meta_code);
write_option("allow_registeration", $allow_register);
write_option("allow_video_upload", $allow_video_upload);
write_option("allow_youtube_videos", $allow_youtube_videos);
write_option("ffmpeg_supported", $ffmpeg);
write_option("ffmpeg_path", mysql_real_escape_string($ffmpeg_path));
write_option("show_welcome_message", $show_welcome_message);
write_option("welcome_message", $welcome_message);
}

if(!empty($save_modules_options) and $save_modules_options=='yes')
{
if($cat=='random videos')
{
write_module_option("random_videos", "enable", $enable);
write_module_option("random_videos", "title", $title);
write_module_option("random_videos", "columns", $cols);
write_module_option("random_videos", "rows", $rows);
write_module_option("random_videos", "image_width", $img_width);
write_module_option("random_videos", "image_height", $img_height);
}

if($cat=='videos slide')
{
write_module_option("videos_slide", "enable", $enable);
}

if($cat=='subtitles in process')
{
write_module_option("subtitles_in_process", "enable", $enable);
write_module_option("subtitles_in_process", "view_title", $view_title);
write_module_option("subtitles_in_process", "view_video", $video);
write_module_option("subtitles_in_process", "view_desc", $desc);
write_module_option("subtitles_in_process", "view_lang", $lang);
write_module_option("subtitles_in_process", "view_done", $done);
write_module_option("subtitles_in_process", "view_join", $join);

write_module_option("subtitles_in_process", "title", $title);
write_module_option("subtitles_in_process", "subtitles_number", $number);
write_module_option("subtitles_in_process", "image_height", $height);
write_module_option("subtitles_in_process", "image_width", $width);
}
}

if(!empty($save_ad_options) and $save_ad_options=='yes')
{
write_option("ad1_enable",$enable1);
write_option("ad2_enable",$enable2);
write_option("ad3_enable",$enable3);
write_option("ad4_enable",$enable4);
write_option("ad5_enable",$enable5);

write_option("ad1_content",$ad1_content);
write_option("ad2_content",$ad2_content);
write_option("ad3_content",$ad3_content);
write_option("ad4_content",$ad4_content);
write_option("ad5_content",$ad5_content);
}

if(!empty($save_theme) and $save_theme=='yes')
{
write_option("theme_folder",$selected_theme_folder);
}


if(empty($page)) include "home.php";
if(!empty($page) and $page=='home') include "home.php";
if(!empty($page) and $page=='settings') include "settings.php";
if(!empty($page) and $page=='modules') include "modules.php";
if(!empty($page) and $page=='ads') include "ads.php";
if(!empty($page) and $page=='themes') include "themes.php";
if(!empty($page) and $page=='subtitles') include "subtitles.php";

include "templates/default/index.html";
?>